﻿using Blog.Core.Domain.Dictionary;
using Blog.Core.DTO.ViewModel.Dictionary;
using Blog.Core.DTO.ViewModel;
using Blog.Core.DTO;
using Blog.Core.IServices;
using Blog.Core.IServices.Dictionary;
using Blog.Core.Repositories.Dictionary;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;

namespace Blog.Core.Api.Controllers.Dictionary
{
    /// <summary>
    /// 字典数据控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class DictDataController : BaseController<DictData>
    {
        private readonly IDictDataService _dicDataService;
        public DictDataController(IBaseService<DictData> baseService,IDictDataService dictDataService) : base(baseService)
        {
            _dicDataService = dictDataService;
        }
        /// <summary>
        /// 字典信息列表
        /// </summary>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        [HttpGet]
        [AllowAnonymous]
        public async Task<IActionResult> GetDictData(int pageindex=1, int pagesize=3, string? name="")
        {
            return Ok(await _dicDataService.GetDictData(pageindex, pagesize, name));
        }
    }
}
